import { hasPermission } from '@/utils/profile'


const direcitves = {
  authority: {
    inserted(el, binding) {
      const { value } = binding
      if (!hasPermission(value)) {
        el.remove()
      }
    }
  }
}

export default {
  install(Vue) {
    Object.keys(direcitves).forEach(k => {
      Vue.directive(k, direcitves[k])
    })
  }
}
